﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace GMusicBoxUpdater
{
    public static class Helper
    {
        public static bool CreateDirectory(string dir)
        {
            bool exist = Directory.Exists(dir);
            if (!exist)
                Directory.CreateDirectory(dir);
            return exist;
        }

        public static string GetStringFromBytes(long bytes)
        {
            if (bytes == 0) return "0 KB";

            string[] keys = new string[] { " Bytes", " KB", " MB", " GB" };
            int i = 0;
            double b = bytes;
            for (i = 0; b >= 1024; i++)
                b /= 1024.0;
            return Math.Round(b, 2).ToString() + keys[i];
        }
    }
}
